#ifndef PID_H
#define PID_H
#include "stm32f4xx.h"

typedef struct pid {
    float p;
    float i;
    float d;
    float error1;
    float error2;
    float error3;
    float d_duty;
    int16_t duty;
    int16_t max_duty;
    int16_t min_duty;
} PIDStruct;

void set_pid_max_duty(PIDStruct *pid, int16_t duty);
void set_pid_min_duty(PIDStruct *pid, int16_t duty);
void set_p_i_d_value(PIDStruct *pid, float p, float i, float d);
void pid_update(PIDStruct *pid, float error);
void pid_clear(PIDStruct *pid);
void pid_update_position(PIDStruct *pid,float error);

#endif
